{template 'common/header'}
<link rel="stylesheet" type="text/css" href="../addons/{php echo $_GPC['m']}/resource/css/style.css" />
<link rel="stylesheet" type="text/css" href="../addons/{php echo $_GPC['m']}/resource/swal/dist/sweetalert2.min.css" />
<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">
            {$xtitle}
        </h3>
    </div>
    <div class="panel-body">
        {template 'Web/menu'}
        <form class="form-horizontal" role="form" method="post" action="{url 'site/entry/'.$_GPC['do'],array('m'=>$_GPC['m'],'op'=>'savemodel','version_id'=>$_GPC['version_id'])}" name="submit" style="padding: 20px 0;">
            <div class="form-group">
                <label for="name" class="col-sm-2 control-label">名称</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control"  name="name" id="name" value="{$list['name']}">
                    <input type="hidden" name="id" value="{$list['id']}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">关于我们图标（50*50）</label>
                <div class="col-sm-8">
                    {php echo tpl_form_field_image('about_icon',$list['content']['about_icon']);}
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-2 control-label">关于我们文字</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control"  name="about_text" id="about_text" value="{$list['content']['about_text']}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">关于我们链接</label>
                <div class="col-sm-8">
                    <div class="input-group ">
                        <input type="text" class="form-control"  name="about_link" value="{$list['content']['about_link']}">
                        <span class="input-group-btn">
                            <button class="btn btn-default link" type="button" data-toggle="modal" data-target="#sort_link">选择文章</button>
                        </span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">新闻动态图标（50*50）</label>
                <div class="col-sm-8">
                    {php echo tpl_form_field_image('news_icon',$list['content']['news_icon']);}
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-2 control-label">新闻动态文字</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control"  name="news_text" id="news_text" value="{$list['content']['news_text']}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">联系我们图标（50*50）</label>
                <div class="col-sm-8">
                    {php echo tpl_form_field_image('contact_icon',$list['content']['contact_icon']);}
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-2 control-label">联系我们文字</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control"  name="contact_text" id="contact_text" value="{$list['content']['contact_text']}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">名师简介图标（50*50）</label>
                <div class="col-sm-8">
                    {php echo tpl_form_field_image('teacher_icon',$list['content']['teacher_icon']);}
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-2 control-label">名师简介文字</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control"  name="teacher_text" id="teacher_text" value="{$list['content']['teacher_text']}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">所有课程图标（50*50）</label>
                <div class="col-sm-8">
                    {php echo tpl_form_field_image('service_icon',$list['content']['service_icon']);}
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-2 control-label">所有课程文字</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control"  name="service_text" id="service_text" value="{$list['content']['service_text']}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">报名缴费图标（50*50）</label>
                <div class="col-sm-8">
                    {php echo tpl_form_field_image('sign_icon',$list['content']['sign_icon']);}
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-2 control-label">报名缴费文字</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control"  name="sign_text" id="sign_text" value="{$list['content']['sign_text']}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">分校查询图标（50*50）</label>
                <div class="col-sm-8">
                    {php echo tpl_form_field_image('search_icon',$list['content']['search_icon']);}
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-2 control-label">报名缴费文字</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control"  name="search_text" id="search_text" value="{$list['content']['search_text']}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">本周课程表图标（50*50）</label>
                <div class="col-sm-8">
                    {php echo tpl_form_field_image('week_icon',$list['content']['week_icon']);}
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-2 control-label">本周课程表文字</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control"  name="week_text" id="week_text" value="{$list['content']['week_text']}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">本周课程表链接</label>
                <div class="col-sm-8">
                    <div class="input-group ">
                        <input type="text" class="form-control"  name="week_link" value="{$list['content']['week_link']}">
                        <span class="input-group-btn">
                            <button class="btn btn-default link" type="button" data-toggle="modal" data-target="#sort_link">选择文章</button>
                        </span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <input type="button" name="submit" class="btn btn-default" value="提交">
                </div>
            </div>
        </form>
    </div>
</div>
<div class="modal fade" id="sort_link"><div class="modal-dialog">
    <style>
        #sort_link .modal-body {padding: 10px 15px;}
        #sort_link .tab-pane {margin-top: 5px; min-height: 400px; max-height: 400px; overflow-y: auto;}
        #sort_tab{margin-bottom: 10px;}
    </style>
    <div class="modal-content">
        <div class="modal-header">
            <button data-dismiss="modal" class="close" type="button">×</button>
            <h4 class="modal-title">链接</h4>
        </div>
        <div class="modal-body">
            <iframe width="100%" height="395" frameborder="no" border="0" scrolling="no" allowtransparency="yes" src="{url 'site/entry/Banner',array('m'=>$_GPC['m'],'op'=>'article')}"></iframe>
        </div>
        <div class="modal-footer">
            <button data-dismiss="modal" class="btn btn-default" id="sort_close" type="button">关闭</button>
        </div>
        <script>
            var sort_objc='';
            $(function(){
                $(".sort_customize").on('click','.sort_link',function(){
                    var id=$(this).attr("data-id");
                    if(id==2){
                        $("#sort_link").find("#sort_tab li").eq(1).hide();
                    }else{
                        $("#sort_link").find("#sort_tab li").eq(1).show();
                    }
                    sort_objc=this;
                });
                $("#sort_link").find('#sort_tab a').click(function(e) {
                    $('#tab').val($(this).attr('href'));
                    e.preventDefault();
                    $(this).tab('show');
                });
            });
        </script>
    </div>
</div></div>
<script>
    var objc="";
    require(["../addons/{php echo $_GPC['m']}/resource/swal/dist/sweetalert2.min.js"],function(){
        $(function(){
            $("body").on("click",'.link',function(){
                objc=this;
            });
            $("input[name='submit']").click(function(){
                var data=$(".form-horizontal").serialize();
                $.ajax({
                    type:"post",
                    url:"{url 'site/entry/'.$_GPC['do'],array('m'=>$_GPC['m'],'op'=>'savenav','version_id'=>$_GPC['version_id'])}",
                    data:data,
                    dataType:'json',
                    success:function(res){
                        if(res.status==1){
                            swal('操作成功!', '操作成功!', 'success');
                        }else{
                            swal('操作失败!', '操作失败!', 'error');
                        }
                    }
                })
            });
        })
    })
</script>
{template 'common/footer'}